package day0;
import org.junit.Test;

public class Day4 {

	public static void main(String[] args) {
		System.out.println("Day4.main()");
	
		
		int[] array1 = new int[] {81, -1, 8, 89, 62, 12};
		int[] array2 = new int[] {1, -1, 56, 8, 99, 2, 12};
		
		int result1 = max(array1);
		System.out.println(result1);
		
		int result2 = max(array2);
		System.out.println(result2);
		
		System.out.println("---------------");
	}
	
	// 把完成一个功能的代码放在一起，可以"方法名(参数)"被多次调用
	// 一个方法只做一件事，这里只计算数组的最大值
	// This method must return a result of type int
	public static int max(int[] array) {
		int max = array[0];
		for (int i = 1; i < array.length; i++) {
			if (array[i] > max) {
				max = array[i];
			} 
		}
		// System.out.println("最大值：" + max);
		return max;
	}
	
	@Test
	public void test4() {
		int num = 3;
		String name = "zhangsan";
		int[] array;
		// 构造一个学生对象
		Student zhangsan = new Student();
		zhangsan.setId(1);;
		zhangsan.setName("zhangsan");
		// zhangsan.age = 200;
		zhangsan.setAge(200);
		zhangsan.setClassName("Java1912");
		zhangsan.study();
		System.out.println(zhangsan.getName());
		
		Student lisi = new Student();
		lisi.setId(2);
		lisi.setName("lisi");;
		lisi.setAge(24);
		lisi.setClassName("UI1912");;
		lisi.study();
		
		Teacher teacher = new Teacher();
		teacher.setId(1);;
		teacher.setName("王五");;
		teacher.setAge(30);
		teacher.teach();
	}
	
	@Test
	public void test44() {
		// 构造一个学生对象
		Student student = new Student();
		student.setId(2);
		// zhangsan.age = 200;
		student.setAge(200);
		
		System.out.println(student.getAge());
	}
	
}
